//package com.wee.fragment;
//
//import android.content.Intent;
//import android.os.Bundle;
//import android.support.v4.app.Fragment;
//import android.view.LayoutInflater;
//import android.view.View;
//import android.view.ViewGroup;
//import android.widget.AdapterView;
//import android.widget.ListView;
//import android.widget.Toast;
//
//import com.bigtotoro.util.SharedPreferencesUtil;
//import com.bigtotoro.widgets.AppProgressBar;
//import com.google.gson.Gson;
//import com.loopj.android.http.AsyncHttpResponseHandler;
//import com.loopj.android.http.RequestParams;
//import com.wee.adapter.CoachAdapter1;
//import com.wee.aircoach_user.CoachInfoActivity;
//import com.wee.aircoach_user.Constant;
//import com.wee.aircoach_user.MyApplication;
//import com.wee.aircoach_user.R;
//import com.wee.entity.Coach_list;
//import com.wee.entity.Coach_listResponse;
//import com.wee.entity.MD5Util;
//
//import org.apache.http.Header;
//
//import java.util.ArrayList;
//import java.util.List;
//
///**
// * Created by Solomon on 2015/11/24.  教练展示页
// */
//public class faxian_fragment1 extends Fragment{
//    private View view;
//    private ListView systemCoachList;
//    private CoachAdapter1 coachAdapter1;
//    private List<Coach_list> lists=new ArrayList<>();
//
//
//    @Override
//    public View onCreateView(LayoutInflater inflater, ViewGroup container, Bundle savedInstanceState) {
//        view=inflater.inflate(R.layout.faxian_fragment1, container, false);
//        initview();
//        return view;
//    }
//
//    private void initview() {
//        systemCoachList = (ListView)view.findViewById(R.id.list_0);
//        coachAdapter1 = new CoachAdapter1(getActivity(), lists);
//        systemCoachList.setAdapter(coachAdapter1);
//        systemCoachList.setOnItemClickListener(new AdapterView.OnItemClickListener() {
//            @Override
//            public void onItemClick(AdapterView<?> parent, View view, int position, long id) {
//
//                Intent intent = new Intent(getActivity(), CoachInfoActivity.class);
//                intent.putExtra("Coachid", lists.get(position).getId() + "");
//                startActivity(intent);
//            }
//        });
//     loadSystemCoac();
//    }
//    private void loadSystemCoac(){
//        int exact=  SharedPreferencesUtil.getInt(getActivity(), Constant.USERTIME);
//        RequestParams params = new RequestParams();
//        AppProgressBar.checkAndCreateProgressBar(getActivity());
//        MyApplication.getInstance().getHttpClient().get(Constant.COACH_LIST+ MD5Util.md5(exact), params, new AsyncHttpResponseHandler() {
//            @Override
//            public void onSuccess(int i, Header[] headers, byte[] bytes) {
//                try{
//                Coach_listResponse response = new Gson().fromJson(new String(bytes), Coach_listResponse.class);
//                if (response != null && response.getData().size() != 0) {
//                    lists.clear();
//                    lists.addAll(response.getData());
//                    coachAdapter1.notifyDataSetChanged();
//                }
//                AppProgressBar.closeProgressBar();
//
//                }catch (Exception r){
//                    Toast.makeText(getActivity(), "网络不稳定", Toast.LENGTH_SHORT).show();
//                    AppProgressBar.closeProgressBar();
//                }
//            }
//
//            @Override
//            public void onFailure(int i, Header[] headers, byte[] bytes, Throwable throwable) {
//                throwable.printStackTrace();
//                AppProgressBar.closeProgressBar();
//            }
//        });
//    }
//
//
//}
